'use strict';
exports.main = async (event, context) => {
	//event为客户端上传的参数
	const APPID = context.APPID
	let db = uniCloud.databaseForJQL().collection('versionList')
	const result = await db.get()
	delete result.data[0]._id
	//返回数据给客户端
	let obj = {
		...result.data[0],
		context:context,
	}
	//如果当前设备app环境下的版本和正在审核的版本一样，这同步一下设备版本信息，跳过更新操作
	const appVersion = context.appWgtVersion
	const osName = context.osName
	if(osName == 'android' && appVersion == obj.examine_android_version){
		obj.android_version = obj.examine_android_version
		obj.wgt_version = obj.examine_android_version
	}
	if(osName == 'ios' && appVersion == obj.examine_ios_version){
		obj.ios_version = obj.examine_ios_version
		obj.wgt_version = obj.examine_ios_version
	}
	return obj
	
};